<?=$header?>

<p>Current Theme: <b><?=$theme?></b> (<a href="theme/edit/<?=$theme?>">Edit</a>)<br />
<br />
Other Themes<br />
<ul>
<?
// $path : path to browse
// $maxdepth : how deep to browse (-1=unlimited)
// $mode : "FULL"|"DIRS"|"FILES"
// $d : must not be defined
 
function searchdir ( $path , $maxdepth = -1 , $mode = "FULL" , $d = 0 )
{
   if ( substr ( $path , strlen ( $path ) - 1 ) != '/' ) { $path .= '/' ; }     
   $dirlist = array () ;
   if ( $mode != "FILES" ) { $dirlist[] = $path ; }
   if ( $handle = opendir ( $path ) )
   {
       while ( false !== ( $file = readdir ( $handle ) ) )
       {
           if ( $file != '.' && $file != '..' )
           {
               $file = $path . $file ;
               if ( ! is_dir ( $file ) ) { if ( $mode != "DIRS" ) { $dirlist[] = $file ; } }
               elseif ( $d >=0 && ($d < $maxdepth || $maxdepth < 0) )
               {
                   $result = searchdir ( $file . '/' , $maxdepth , $mode , $d + 1 ) ;
                   $dirlist = array_merge ( $dirlist , $result ) ;
               }
       }
       }
       closedir ( $handle ) ;
   }
   if ( $d == 0 ) { natcasesort ( $dirlist ) ; }
   return ( $dirlist ) ;
}


$map = searchdir('themes/', 1, "DIRS");
foreach ($map as $file)
{
	if(is_dir($file)){
		$file = substr($file, 7, -1);
		if($file != ""){
			if($file != $theme) {
				echo '<li><a href="'.base_url().'theme/choose/'.$file.'">'.$file.'</a></li>'; 
			}
		}
	}
}
?>
</ul>
</p>

<?=$footer?>

</body>
</html>